﻿using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Runtime.Serialization.Formatters.Binary;
using System.Threading;
using Argos.Collections;
using Argos.Design;
using Argos.Scheduling;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.ComponentModel.Design.Serialization;

namespace Argos.Core.Tests
{
	/// <summary>
	/// Summary description for TimeTests
	/// </summary>
	[TestClass]
	public class TimeTests
	{

		#region public TestContext TestContext { get; set; }

		private TestContext testContextInstance;

		/// <summary>
		///Gets or sets the test context which provides
		///information about and functionality for the current test run.
		///</summary>
		public TestContext TestContext
		{
			get
			{
				return testContextInstance;
			}
			set
			{
				testContextInstance = value;
			}
		}

		#endregion



		#region Test: public void AddTime01()

		[global::Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()]
		[global::Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute(" ")]
		public void AddTime01()
		{
			TimeOfDay t1 = new TimeOfDay(23, 59);
			TimeOfDay t2 = t1.Add(TimeSpan.FromMinutes(2));

			Assert.AreEqual<string>("00:01", t2.ToString());
		}

		#endregion

		#region Test: public void AddTime02()

		[global::Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()]
		[global::Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute(" ")]
		public void AddTime02()
		{
			TimeOfDay t1 = new TimeOfDay(0, 1);
			TimeOfDay t2 = t1.Add(TimeSpan.FromMinutes(-2));

			Assert.AreEqual<string>("23:59", t2.ToString());
		}

		#endregion
		


		#region Test: public void CompareTime01()

		[global::Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()]
		[global::Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute(" ")]
		public void CompareTime01()
		{
			TimeOfDay t1 = new TimeOfDay(1);
			TimeOfDay t2 = new TimeOfDay(1, 1);

			Assert.IsTrue(t2 > t1);
		}

		#endregion

		#region Test: public void CompareTime02()

		[global::Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()]
		[global::Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute(" ")]
		public void CompareTime02()
		{
			TimeOfDay t1 = new TimeOfDay(8);
			TimeOfDay t2 = new TimeOfDay(7, 59, 59, 999);

			Assert.IsTrue(t2 < t1);
		}

		#endregion

		#region Test: public void CompareTime03()

		[global::Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()]
		[global::Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute(" ")]
		public void CompareTime03()
		{
			TimeOfDay t1 = new TimeOfDay(1, 2, 3, 4);
			TimeOfDay t2 = t1.Add(TimeSpan.Zero);
			Assert.AreEqual<TimeOfDay>(t1, t2);
			Assert.IsTrue(t1 == t2);
		}

		#endregion

		#region Test: public void CompareTime04()

		[global::Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()]
		[global::Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute(" ")]
		public void CompareTime04()
		{
			DateTime dt = DateTime.Now;
			DateTime utc = dt.ToUniversalTime();

			TimeOfDay t1 = new TimeOfDay(dt);
			TimeOfDay t2 = new TimeOfDay(utc);

			Assert.AreNotEqual<TimeOfDay>(t1, t2);
		}

		#endregion

		#region Test: public void CompareTime05()

		[global::Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()]
		[global::Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute(" ")]
		public void CompareTime05()
		{
			DateTime dt = DateTime.Now;
			DateTime utc = dt.ToUniversalTime().Add(TimeSpan.FromMinutes(1));

			TimeOfDay t1 = new TimeOfDay(dt);
			TimeOfDay t2 = new TimeOfDay(utc);

			Assert.IsTrue(t1 < t2);
		}

		#endregion

		#region Test: public void CompareTime06()

		[global::Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()]
		[global::Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute(" ")]
		public void CompareTime06()
		{
			DateTime dt = DateTime.Now;
			DateTime utc = dt.ToUniversalTime().Add(TimeSpan.FromMinutes(-1));

			TimeOfDay t1 = new TimeOfDay(dt);
			TimeOfDay t2 = new TimeOfDay(utc);

			Assert.IsTrue(t1 > t2);
		}

		#endregion



		#region Test: public void CompareTimeSlot01()

		[global::Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()]
		[global::Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute(" ")]
		public void CompareTimeSlot01()
		{
			TimeSlot slot1 = TimeSlot.FromStartTime(new TimeOfDay(10));
			TimeSlot slot2 = TimeSlot.FromStartTime(new TimeOfDay(11));

			Assert.IsTrue(slot2 > slot1);
		}

		#endregion

		#region Test: public void CompareTimeSlot02()

		[global::Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()]
		[global::Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute(" ")]
		public void CompareTimeSlot02()
		{
			TimeSlot slot1 = TimeSlot.FromStartTime(new TimeOfDay(10));
			TimeSlot slot2 = TimeSlot.FromStartTime(new TimeOfDay(11));

			Assert.IsTrue(slot1 < slot2);
		}

		#endregion

		#region Test: public void CompareTimeSlot03()

		[global::Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()]
		[global::Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute(" ")]
		public void CompareTimeSlot03()
		{
			TimeSlot slot1 = TimeSlot.FromStartTime(new TimeOfDay(1));
			TimeSlot slot2 = TimeSlot.FromStartTime(new TimeOfDay(1));

			Assert.IsTrue(slot1 == slot2);
		}

		#endregion

		#region Test: public void CompareTimeSlot04()

		[global::Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()]
		[global::Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute(" ")]
		public void CompareTimeSlot04()
		{
			TimeSlot slot1 = TimeSlot.FromStartTime(new TimeOfDay(8), TimeSpan.FromMinutes(1));
			TimeSlot slot2 = TimeSlot.FromStartTime(new TimeOfDay(8));

			Assert.IsTrue(slot1 > slot2);
		}

		#endregion

		#region Test: public void CompareTimeSlot05()

		[global::Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()]
		[global::Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute(" ")]
		public void CompareTimeSlot05()
		{
			DateTime dt = DateTime.Now;

			TimeSlot slot1 = TimeSlot.FromStartTime(new TimeOfDay(dt));
			TimeSlot slot2 = TimeSlot.FromStartTime(new TimeOfDay(dt.ToUniversalTime()));

			Assert.IsFalse(slot1 == slot2);
			Assert.IsTrue(slot1 != slot2);
		}

		#endregion



		#region Test: public void CompareSchedule01()

		[global::Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()]
		[global::Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute(" ")]
		public void CompareSchedule01()
		{
			Schedule s1 = WeeklySchedule.OfficeHours;
			Schedule s2 = WeeklySchedule.OfficeHours;

			Assert.AreEqual<Schedule>(s1, s2);
		}

		#endregion

		#region Test: public void CompareSchedule02()

		[global::Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()]
		[global::Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute(" ")]
		public void CompareSchedule02()
		{
			Schedule s1 = Schedule.OfficeHours;
			Schedule s2 = Schedule.OfficeHours;

			Assert.AreEqual<Schedule>(s1, s2);
		}

		#endregion

		#region Test: public void CompareSchedule03()

		[global::Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()]
		[global::Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute(" ")]
		public void CompareSchedule03()
		{
			Schedule s1 = Schedule.OfficeHours;
			byte[] buffer = s1.ToByteArray();
			Schedule s2 = Schedule.Read(buffer);

			Assert.AreEqual<Schedule>(s1, s2);
		}

		#endregion
		


		#region Test: public void CompareScheduleEntry01()

		[global::Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()]
		[global::Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute(" ")]
		public void CompareScheduleEntry01()
		{
			WeeklySchedule.Entry e1 = new WeeklySchedule.Entry(DayOfWeek.Monday, new TimeOfDay(8), TimeSpan.FromHours(8));
			WeeklySchedule.Entry e2 = new WeeklySchedule.Entry(DayOfWeek.Monday, new TimeOfDay(8), TimeSpan.FromHours(8));

			Assert.AreEqual<WeeklySchedule.Entry>(e1, e2);
		}

		#endregion

		#region Test: public void CompareScheduleEntry02()

		[global::Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()]
		[global::Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute(" ")]
		public void CompareScheduleEntry02()
		{
			WeeklySchedule.Entry e1 = new WeeklySchedule.Entry(DayOfWeek.Monday, new TimeOfDay(8), TimeSpan.FromHours(8));
			WeeklySchedule.Entry e2 = new WeeklySchedule.Entry(DayOfWeek.Monday, new TimeOfDay(8), TimeSpan.FromHours(9));

			Assert.AreNotEqual<WeeklySchedule.Entry>(e1, e2);
		}

		#endregion

		#region Test: public void CompareScheduleEntry03()

		[global::Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()]
		[global::Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute(" ")]
		public void CompareScheduleEntry03()
		{
			ScheduleEntry e1 = new WeeklySchedule.Entry(DayOfWeek.Monday, new TimeOfDay(8), TimeSpan.FromHours(8));
			ScheduleEntry e2 = new WeeklySchedule.Entry(DayOfWeek.Monday, new TimeOfDay(8), TimeSpan.FromHours(8));

			Assert.AreEqual<ScheduleEntry>(e1, e2);
		}

		#endregion

		#region Test: public void CompareScheduleEntry04()

		[global::Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()]
		[global::Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute(" ")]
		public void CompareScheduleEntry04()
		{
			WeeklySchedule.Entry e1 = new WeeklySchedule.Entry(DayOfWeek.Monday, new TimeOfDay(8), TimeSpan.FromHours(8));
			WeeklySchedule.Entry e2 = new WeeklySchedule.Entry(DayOfWeek.Monday, new TimeOfDay(8), TimeSpan.FromHours(8));

			Assert.IsTrue(e1 == e2);
		}

		#endregion

		#region Test: public void CompareScheduleEntry05()

		[global::Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()]
		[global::Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute(" ")]
		public void CompareScheduleEntry05()
		{
			WeeklySchedule.Entry e1 = new WeeklySchedule.Entry(DayOfWeek.Monday, new TimeOfDay(8), TimeSpan.FromHours(8));
			WeeklySchedule.Entry e2 = new WeeklySchedule.Entry(DayOfWeek.Monday, new TimeOfDay(8), TimeSpan.FromHours(7));

			Assert.IsTrue(e1 != e2);
		}

		#endregion
		


		#region Test: public void CreateOccurrence01()

		[global::Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()]
		[global::Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute(" ")]
		public void CreateOccurrence01()
		{
			DateTime dt = DateTime.Now;
			Occurrence o = new Occurrence(dt);

			Assert.AreEqual<DateTime>(dt, o.Start);
			Assert.AreEqual<DateTime>(dt, o.End);
			Assert.AreEqual<string>(dt.ToString(), o.ToString());
		}

		#endregion

		#region Test: public void CreateOccurrence02()

		[global::Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()]
		[global::Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute(" ")]
		public void CreateOccurrence02()
		{
			DateTime dt1 = DateTime.Now;
			DateTime dt2 = dt1.Add(TimeSpan.FromHours(1));

			Occurrence o = new Occurrence(dt1, dt2);
			Assert.AreEqual<DateTime>(dt1, o.Start);
			Assert.AreEqual<DateTime>(dt2, o.End);
			Assert.AreEqual<TimeSpan>(TimeSpan.FromHours(1), o.Duration);
		}

		#endregion
		
		


		#region Test: public void CreateSchedule01()

		[global::Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()]
		[global::Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute(" ")]
		public void CreateSchedule01()
		{
			WeeklySchedule ws = new WeeklySchedule();
			ws.Entries.Add(new WeeklySchedule.Entry(DayOfWeek.Monday, new TimeOfDay(8)));

			Assert.AreEqual<string>("Monday at 08:00", ws.ToString());
		}

		#endregion

		#region Test: public void CreateSchedule02()

		[global::Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()]
		[global::Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute(" ")]
		public void CreateSchedule02()
		{
			Schedule ws = Schedule.OfficeHours;
			string expected = "Monday at 08:00 to 16:00, Tuesday at 08:00 to 16:00, Wednesday at 08:00 to 16:00, Thursday at 08:00 to 16:00, Friday at 08:00 to 16:00";
			string actual = ws.ToString();
			Assert.AreEqual<string>(expected, actual);
		}

		#endregion

		#region Test: public void CreateSchedule03()

		[global::Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()]
		[global::Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute(" ")]
		public void CreateSchedule03()
		{
			WeeklySchedule ws = new WeeklySchedule();
			ws.Entries.Add(new WeeklySchedule.Entry(DayOfWeek.Sunday, new TimeOfDay(0, 0, 0, 0, TimeKind.Utc), TimeSpan.FromHours(1)));

			Assert.AreEqual<string>("Sunday at 00:00Z to 01:00Z", ws.ToString());
		}

		#endregion

		#region Test: public void CreateSchedule04()

		[global::Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()]
		[global::Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute(" ")]
		public void CreateSchedule04()
		{
			DateTime now = DateTime.Now;
			WeeklySchedule schedule = WeeklySchedule.FromOccurrences(new Occurrence(now),new Occurrence(now.Add(TimeSpan.FromDays(1))));

			Assert.AreEqual<int>(2, schedule.Entries.Count);
			WeeklySchedule.Entry e1 = (WeeklySchedule.Entry)schedule.Entries[0];
			WeeklySchedule.Entry e2 = (WeeklySchedule.Entry)schedule.Entries[1];

			Assert.AreNotEqual<DayOfWeek>(e1.Day, e2.Day);
		}

		#endregion

		#region Test: public void CreateSchedule05()

		[global::Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()]
		[global::Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute(" ")]
		public void CreateSchedule05()
		{
			DateTime dt1 = DateTime.Now;
			DateTime dt2 = dt1.AddDays(1);

			Schedule s = new CustomSchedule();
			s.AddDateTime(dt1);
			s.AddDateTime(dt2);

			Assert.AreEqual<int>(2, s.Entries.Count);
		}

		#endregion

		#region Test: public void CreateSchedule06()

		[global::Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()]
		[global::Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute(" ")]
		public void CreateSchedule06()
		{
			DateTime dt = DateTime.Now;

			CustomSchedule s = new CustomSchedule();
			s.AddDateTime(dt);
			s.AddDateTime(dt);

			Assert.AreEqual<int>(1, s.Entries.Count);
		}

		#endregion
		


		#region Test: public void CreateTimeOfDay01()

		[global::Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()]
		[global::Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute("Creates a time of day struct and checks the ToString method.")]
		public void CreateTimeOfDay01()
		{
			TimeOfDay tod = new TimeOfDay();
			tod.Hour = 12;
			tod.Minute = 30;
			tod.Second = 26;

			Assert.AreEqual<string>("12:30:26", tod.ToString());
		}

		#endregion

		#region Test: public void CreateTimeOfDay02()

		[global::Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()]
		[global::Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute("Creates a time of day struct and checks the ToString method.")]
		public void CreateTimeOfDay02()
		{
			TimeOfDay tod = new TimeOfDay();
			tod.Hour = 23;
			tod.Minute = 19;
			tod.Second = 20;
			tod.Millisecond = 525;

			Assert.AreEqual<string>("23:19:20.525", tod.ToString());
		}

		#endregion

		#region Test: public void CreateTimeOfDay03()

		[global::Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()]
		[global::Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute("Creates a time of day struct and makes sure that UTC time is specified in the ToString method.")]
		public void CreateTimeOfDay03()
		{
			TimeOfDay tod = new TimeOfDay(15, 20);
			tod.Kind = TimeKind.Utc;

			Assert.AreEqual<string>("15:20Z", tod.ToString());
		}

		#endregion

		#region Test: public void CreateTimeOfDay04()

		[global::Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()]
		[global::Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute(" ")]
		public void CreateTimeOfDay04()
		{
			TimeOfDay tod = new TimeOfDay(9, 0, 0, 100);
			Assert.AreEqual<string>("09:00:00.100", tod.ToString());
		}

		#endregion

		#region Test: public void CreateTimeOfDay05()

		[global::Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()]
		[global::Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute("Creates a time of day struct with invalid values and asserts an exception.")]
		[global::Microsoft.VisualStudio.TestTools.UnitTesting.ExpectedExceptionAttribute(typeof(ArgumentOutOfRangeException))]
		public void CreateTimeOfDay05()
		{
			TimeOfDay tod = new TimeOfDay();
			tod.Hour = -1;
		}

		#endregion

		#region Test: public void CreateTimeOfDay06()

		[global::Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()]
		[global::Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute("Creates a time of day struct with invalid values and asserts an exception.")]
		[global::Microsoft.VisualStudio.TestTools.UnitTesting.ExpectedExceptionAttribute(typeof(ArgumentOutOfRangeException))]
		public void CreateTimeOfDay06()
		{
			TimeOfDay tod = new TimeOfDay();
			tod.Hour = 24;
		}

		#endregion

		#region Test: public void CreateTimeOfDay07()

		[global::Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()]
		[global::Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute("Creates a time of day struct with invalid values and asserts an exception.")]
		[global::Microsoft.VisualStudio.TestTools.UnitTesting.ExpectedExceptionAttribute(typeof(ArgumentOutOfRangeException))]
		public void CreateTimeOfDay07()
		{
			TimeOfDay tod = new TimeOfDay();
			tod.Minute = -1;
		}

		#endregion

		#region Test: public void CreateTimeOfDay08()

		[global::Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()]
		[global::Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute("Creates a time of day struct with invalid values and asserts an exception.")]
		[global::Microsoft.VisualStudio.TestTools.UnitTesting.ExpectedExceptionAttribute(typeof(ArgumentOutOfRangeException))]
		public void CreateTimeOfDay08()
		{
			TimeOfDay tod = new TimeOfDay();
			tod.Minute = 60;
		}

		#endregion

		#region Test: public void CreateTimeOfDay09()

		[global::Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()]
		[global::Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute("Creates a time of day struct with invalid values and asserts an exception.")]
		[global::Microsoft.VisualStudio.TestTools.UnitTesting.ExpectedExceptionAttribute(typeof(ArgumentOutOfRangeException))]
		public void CreateTimeOfDay09()
		{
			TimeOfDay tod = new TimeOfDay();
			tod.Second = -1;
		}

		#endregion

		#region Test: public void CreateTimeOfDay10()

		[global::Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()]
		[global::Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute("Creates a time of day struct with invalid values and asserts an exception.")]
		[global::Microsoft.VisualStudio.TestTools.UnitTesting.ExpectedExceptionAttribute(typeof(ArgumentOutOfRangeException))]
		public void CreateTimeOfDay10()
		{
			TimeOfDay tod = new TimeOfDay();
			tod.Second = 60;
		}

		#endregion

		#region Test: public void CreateTimeOfDay11()

		[global::Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()]
		[global::Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute("Creates a time of day struct with invalid values and asserts an exception.")]
		[global::Microsoft.VisualStudio.TestTools.UnitTesting.ExpectedExceptionAttribute(typeof(ArgumentOutOfRangeException))]
		public void CreateTimeOfDay11()
		{
			TimeOfDay tod = new TimeOfDay();
			tod.Millisecond = -1;
		}

		#endregion

		#region Test: public void CreateTimeOfDay12()

		[global::Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()]
		[global::Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute("Creates a time of day struct with invalid values and asserts an exception.")]
		[global::Microsoft.VisualStudio.TestTools.UnitTesting.ExpectedExceptionAttribute(typeof(ArgumentOutOfRangeException))]
		public void CreateTimeOfDay12()
		{
			TimeOfDay tod = new TimeOfDay();
			tod.Millisecond = 1000;
		}

		#endregion

		#region Test: public void CreateTimeOfDay13()

		[global::Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()]
		[global::Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute(" ")]
		public void CreateTimeOfDay13()
		{
			DateTime local = DateTime.Now;
			DateTime utc = local.ToUniversalTime();

			TimeOfDay localTime = new TimeOfDay(local);
			TimeOfDay utcTime1 = localTime.ToUtcTime();
			TimeOfDay utcTime2 = new TimeOfDay(utc);

			Assert.AreEqual<TimeOfDay>(utcTime1, utcTime2);
		}

		#endregion

		#region Test: public void CreateTimeOfDay14()

		[global::Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()]
		[global::Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute(" ")]
		public void CreateTimeOfDay14()
		{
			DateTime local = DateTime.Now;
			DateTime utc = local.ToUniversalTime();

			TimeOfDay utcTime = new TimeOfDay(utc);
			TimeOfDay localTime1 = utcTime.ToLocalTime();
			TimeOfDay localTime2 = new TimeOfDay(local);

			Assert.AreEqual<TimeOfDay>(localTime1, localTime2);
		}

		#endregion

		#region Test: public void CreateTimeOfDay15()

		[global::Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()]
		[global::Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute(" ")]
		public void CreateTimeOfDay15()
		{
			TimeOfDay t = new TimeOfDay(18, 0, 0, 0, TimeKind.Utc);
			DateTime dt = t.ToDateTime();
			Assert.AreEqual<DateTimeKind>(DateTimeKind.Utc, dt.Kind);
		}

		#endregion

		#region Test: public void CreateTimeOfDay16()

		[global::Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()]
		[global::Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute(" ")]
		public void CreateTimeOfDay16()
		{
			TimeOfDay t = new TimeOfDay(18, 0, 0, 0, TimeKind.Utc);
			DateTime dt = t.ToDateTime();
			Assert.AreEqual<int>(18, dt.Hour);
		}

		#endregion

		#region Test: public void CreateTimeOfDay17()

		[global::Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()]
		[global::Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute(" ")]
		public void CreateTimeOfDay17()
		{
			DateTime dt = DateTime.Now.ToLocalTime();
			TimeOfDay t = new TimeOfDay(dt);
			Assert.AreEqual<TimeKind>(TimeKind.Local, t.Kind);

			DateTime dt2 = t.ToDateTime(2000, 1, 1);
			Assert.AreEqual<DateTimeKind>(DateTimeKind.Local, dt2.Kind);
		}

		#endregion

		#region Test: public void CreateTimeOfDay18()

		[global::Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()]
		[global::Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute(" ")]
		public void CreateTimeOfDay18()
		{
			DateTime dt = DateTime.Now.ToUniversalTime();
			TimeOfDay t = new TimeOfDay(dt);
			Assert.AreEqual<TimeKind>(TimeKind.Utc, t.Kind);

			DateTime dt2 = t.ToDateTime(2000, 1, 1);
			Assert.AreEqual<DateTimeKind>(DateTimeKind.Utc, dt2.Kind);
		}

		#endregion

		#region Test: public void CreateTimeOfDay19()

		[global::Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()]
		[global::Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute(" ")]
		public void CreateTimeOfDay19()
		{
			DateTime local = DateTime.Now;
			DateTime utc = local.ToUniversalTime();

			TimeOfDay localTime = new TimeOfDay(local);
			TimeOfDay utcTime = new TimeOfDay(utc);
			TimeOfDay utcTime2 = localTime.ToUtcTime();

			Assert.AreEqual<TimeOfDay>(utcTime, utcTime2);
		}

		#endregion

		#region Test: public void CreateTimeOfDay20()

		[global::Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()]
		[global::Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute(" ")]
		public void CreateTimeOfDay20()
		{
			DateTime local = DateTime.Now;
			DateTime utc = local.ToUniversalTime();

			TimeOfDay utcTime = new TimeOfDay(utc);
			TimeOfDay localTime = new TimeOfDay(local);
			TimeOfDay localTime2 = utcTime.ToLocalTime();

			Assert.AreEqual<TimeOfDay>(localTime, localTime2);
		}

		#endregion

		#region Test: public void CreateTimeOfDay21()

		[global::Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()]
		[global::Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute(" ")]
		public void CreateTimeOfDay21()
		{
			InstanceDescriptor id = new InstanceDescriptor(typeof(TimeOfDay).GetConstructor(new Type[] { typeof(int), typeof(int), typeof(int) }), new int[] { 8, 30, 45 });
			TimeOfDayConverter converter = new TimeOfDayConverter();
			TimeOfDay t = (TimeOfDay)converter.ConvertFrom(id);

			Assert.AreEqual<TimeOfDay>(TimeOfDay.Parse("8:30:45"), t);
		}

		#endregion

		#region Test: public void CreateTimeOfDay22()

		[global::Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()]
		[global::Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute(" ")]
		public void CreateTimeOfDay22()
		{
			TimeOfDay t1 = TimeOfDay.Parse("14:20:30.550Z");
			TimeOfDayConverter converter = new TimeOfDayConverter();
			InstanceDescriptor id = (InstanceDescriptor)converter.ConvertTo(t1, typeof(InstanceDescriptor));
			TimeOfDay t2 = (TimeOfDay)converter.ConvertFrom(id);

			Assert.AreEqual<TimeOfDay>(t1, t2);
		}

		#endregion
		


		#region Test: public void CreateTimeSlotList01()

		[global::Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()]
		[global::Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute(" ")]
		public void CreateTimeSlotList01()
		{
			TimeSlot slot1 = TimeSlot.FromStartTime(new TimeOfDay(10));
			TimeSlot slot2 = TimeSlot.FromStartTime(new TimeOfDay(11));

			TimeSlotList list = new TimeSlotList();
			list.Add(slot2);
			list.Add(slot1);

			TimeSlot actual = list.GetNextTimeSlot(slot1.Start);
			Assert.AreEqual<TimeSlot>(slot2, actual);
		}

		#endregion

		#region Test: public void CreateTimeSlotList02()

		[global::Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()]
		[global::Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute(" ")]
		public void CreateTimeSlotList02()
		{
			TimeSlot slot1 = TimeSlot.FromStartTime(new TimeOfDay(15), TimeSpan.FromHours(1));
			TimeSlot slot2 = TimeSlot.FromStartTime(new TimeOfDay(14, 59, 59, 999));

			TimeSlotList list = new TimeSlotList();
			list.Add(slot1);
			list.Add(slot2);

			TimeSlot actual = list.GetNextTimeSlot(slot2.Start);
			Assert.AreEqual<TimeSlot>(slot1, actual);
		}

		#endregion
		


		#region Test: public void CreateWeekdayList01()

		[global::Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()]
		[global::Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute(" ")]
		public void CreateWeekdayList01()
		{
			Thread.CurrentThread.CurrentCulture = new CultureInfo("fi-FI");
			WeekdayList list = WeekdayList.AllDays;
			Assert.AreEqual<int>(7, list.Count);
			Assert.AreEqual<DayOfWeek>(DayOfWeek.Monday, list[0]);
		}

		#endregion

		#region Test: public void CreateWeekdayList02()

		[global::Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()]
		[global::Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute(" ")]
		public void CreateWeekdayList02()
		{
			Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");
			WeekdayList list = WeekdayList.AllDays;
			Assert.AreEqual<int>(7, list.Count);
			Assert.AreEqual<DayOfWeek>(DayOfWeek.Sunday, list[0]);
		}

		#endregion

		#region Test: public void CreateWeekdayList03()

		[global::Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()]
		[global::Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute(" ")]
		public void CreateWeekdayList03()
		{
			WeekdayList list = WeekdayList.WorkDays;
			DayOfWeek day = list.GetNextDay(DayOfWeek.Monday);
			Assert.AreEqual<DayOfWeek>(DayOfWeek.Tuesday, day);
		}

		#endregion

		#region Test: public void CreateWeekdayList04()

		[global::Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()]
		[global::Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute(" ")]
		public void CreateWeekdayList04()
		{
			WeekdayList list = WeekdayList.WorkDays;
			DayOfWeek day = list.GetNextDay(DayOfWeek.Friday);
			Assert.AreEqual<DayOfWeek>(DayOfWeek.Monday, day);
		}

		#endregion

		#region Test: public void CreateWeekdayList05()

		[global::Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()]
		[global::Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute(" ")]
		public void CreateWeekdayList05()
		{
			WeekdayList list = WeekdayList.Weekend;
			DayOfWeek day = list.GetNextDay(DayOfWeek.Sunday);
			Assert.AreEqual<DayOfWeek>(DayOfWeek.Saturday, day);
		}

		#endregion

		#region Test: public void CreateWeekdayList06()

		[global::Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()]
		[global::Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute(" ")]
		public void CreateWeekdayList06()
		{
			WeekdayList list = WeekdayList.WorkDays;
			DayOfWeek day = list.GetNextDay(DayOfWeek.Saturday);
			Assert.AreEqual<DayOfWeek>(DayOfWeek.Monday, day);
		}

		#endregion

		#region Test: public void CreateWeekdayList07()

		[global::Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()]
		[global::Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute(" ")]
		public void CreateWeekdayList07()
		{
			WeekdayList list = new WeekdayList();
			list.Add(DayOfWeek.Monday);

			DayOfWeek day = list.GetNextDay(DayOfWeek.Monday);
			Assert.AreEqual<DayOfWeek>(DayOfWeek.Monday, day);
		}

		#endregion

		#region Test: public void CreateWeekdayList08()

		[global::Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()]
		[global::Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute(" ")]
		public void CreateWeekdayList08()
		{
			WeekdayList list = new WeekdayList();
			list.Add(DayOfWeek.Sunday);
			DayOfWeek day = list.GetNextDay(DayOfWeek.Monday);
			Assert.AreEqual<DayOfWeek>(DayOfWeek.Sunday, day);
		}

		#endregion

		#region Test: public void CreateWeekdayList09()

		[global::Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()]
		[global::Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute(" ")]
		public void CreateWeekdayList09()
		{
			WeekdayList list = WeekdayList.WorkDays;
			DayOfWeek day = list.GetPreviousDay(DayOfWeek.Friday);
			Assert.AreEqual<DayOfWeek>(DayOfWeek.Thursday, day);
		}

		#endregion

		#region Test: public void CreateWeekdayList10()

		[global::Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()]
		[global::Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute(" ")]
		public void CreateWeekdayList10()
		{
			WeekdayList list = WeekdayList.WorkDays;
			DayOfWeek day = list.GetPreviousDay(DayOfWeek.Monday);
			Assert.AreEqual<DayOfWeek>(DayOfWeek.Friday, day);
		}

		#endregion

		#region Test: public void CreateWeekdayList11()

		[global::Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()]
		[global::Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute(" ")]
		[global::Microsoft.VisualStudio.TestTools.UnitTesting.ExpectedExceptionAttribute(typeof(InvalidOperationException))]
		public void CreateWeekdayList11()
		{
			WeekdayList list = new WeekdayList();
			DayOfWeek day = list.GetNextDay(DayOfWeek.Monday);
		}

		#endregion

		#region Test: public void CreateWeekdayList12()

		[global::Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()]
		[global::Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute(" ")]
		[global::Microsoft.VisualStudio.TestTools.UnitTesting.ExpectedExceptionAttribute(typeof(InvalidOperationException))]
		public void CreateWeekdayList12()
		{
			WeekdayList list = new WeekdayList();
			DayOfWeek day = list.GetPreviousDay(DayOfWeek.Monday);
		}

		#endregion

		#region Test: public void CreateWeekdayList13()

		[global::Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()]
		[global::Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute(" ")]
		public void CreateWeekdayList13()
		{
			WeekdayList list = new WeekdayList();
			list.Add(DayOfWeek.Sunday);
			DayOfWeek day = list.GetPreviousDay(DayOfWeek.Sunday);
			Assert.AreEqual<DayOfWeek>(DayOfWeek.Sunday, day);
		}

		#endregion



		#region Test: public void DeserializeOccurrence01()

		[global::Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()]
		[global::Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute(" ")]
		public void DeserializeOccurrence01()
		{
			Occurrence o1 = new Occurrence(DateTime.Now);
			Occurrence o2 = null;

			using (MemoryStream strm = new MemoryStream())
			{
				BinaryFormatter bf = new BinaryFormatter();
				bf.Serialize(strm, o1);

				strm.Position = 0;

				o2 = (Occurrence)bf.Deserialize(strm);
			}

			Assert.AreEqual<Occurrence>(o1, o2);
		}

		#endregion
		


		#region Test: public void DeserializeSchedule01()

		[global::Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()]
		[global::Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute(" ")]
		public void DeserializeSchedule01()
		{
			WeeklySchedule s;

			using (MemoryStream strm = new MemoryStream())
			{
				strm.Write(Properties.Resources.OfficeHoursSchedule, 0, Properties.Resources.OfficeHoursSchedule.Length);
				strm.Flush();
				strm.Position = 0;

				BinaryFormatter formatter = new BinaryFormatter();
				s = (WeeklySchedule)formatter.Deserialize(strm);
			}

			Assert.AreEqual<int>(5, s.Entries.Count);
			Assert.AreEqual<Schedule>(Schedule.OfficeHours, s);
		}

		#endregion

		#region Test: public void DeserializeSchedule02()

		[global::Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()]
		[global::Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute(" ")]
		public void DeserializeSchedule02()
		{
			Schedule s1 = Schedule.OfficeHours;
			byte[] buffer = s1.ToByteArray();

			Schedule s2 = Schedule.Read(buffer);
			Assert.AreEqual<Schedule>(s1, s2);
		}

		#endregion
		


		#region Test: public void GetNextScheduleOccurrence01()

		[global::Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()]
		[global::Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute(" ")]
		public void GetNextScheduleOccurrence01()
		{
			WeeklySchedule schedule = new WeeklySchedule();

			TimeOfDay nextTime = new TimeOfDay(TimeOfDay.Now.Hour).Add(TimeSpan.FromHours(1));
			schedule.AddDateTime(nextTime.ToDateTime());

			Occurrence expected = new Occurrence(nextTime.ToDateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day));
			Occurrence actual = schedule.GetNextOccurrence();

			Assert.AreEqual<Occurrence>(expected, actual);
		}

		#endregion

		#region Test: public void GetNextScheduleOccurrence02()

		[global::Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()]
		[global::Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute(" ")]
		public void GetNextScheduleOccurrence02()
		{
			Occurrence previousOccurrence = new Occurrence(DateTime.Now.Add(TimeSpan.FromHours(-1)));
			Occurrence nextOccurrence = new Occurrence(previousOccurrence.Start.Add(TimeSpan.FromHours(2)));

			WeeklySchedule schedule = WeeklySchedule.FromOccurrences(previousOccurrence, nextOccurrence);

			Occurrence actual = schedule.GetNextOccurrence();
			Assert.AreEqual<Occurrence>(nextOccurrence, actual);
		}

		#endregion

		#region Test: public void GetNextScheduleOccurrence03()

		[global::Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()]
		[global::Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute(" ")]
		public void GetNextScheduleOccurrence03()
		{
			DateTime dt1 = DateTime.Now.Add(TimeSpan.FromDays(-1));
			DateTime dt2 = dt1.Add(TimeSpan.FromDays(1)).Add(TimeSpan.FromHours(-1));
			DateTime dt3 = dt2.Add(TimeSpan.FromHours(2));
			DateTime dt4 = dt1.Add(TimeSpan.FromDays(2));

			WeeklySchedule schedule = WeeklySchedule.FromOccurrences(new Occurrence(dt1), new Occurrence(dt2, TimeSpan.FromDays(2)), new Occurrence(dt3), new Occurrence(dt4));
			Occurrence actual = schedule.GetNextOccurrence(DateTime.Now);

			Assert.AreEqual<DateTime>(dt3, actual.Start);
		}

		#endregion

		#region Test: public void GetNextScheduleOccurrence04()

		[global::Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()]
		[global::Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute(" ")]
		public void GetNextScheduleOccurrence04()
		{
			DateTime dt = DateTime.Now.AddDays(1).AddHours(-1);
			WeeklySchedule.Entry entry = new WeeklySchedule.Entry(dt.DayOfWeek, new TimeOfDay(dt), TimeSpan.FromHours(1));
			Occurrence o = entry.GetNextOccurrence();

			Assert.AreEqual<TimeSpan>(TimeSpan.FromHours(1), o.Duration);
			Assert.AreEqual<DateTime>(dt, o.Start);
		}

		#endregion

		#region Test: public void GetNextScheduleOccurrence05()

		[global::Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()]
		[global::Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute(" ")]
		public void GetNextScheduleOccurrence05()
		{
			DateTime dt2 = DateTime.Now.AddMinutes(-1);
			DateTime dt1 = dt2.AddDays(-1);
			DateTime dt3 = dt2.AddDays(1);

			CustomSchedule s = new CustomSchedule();
			s.AddDateTime(dt1);
			s.AddDateTime(dt2);
			s.AddDateTime(dt3);

			Occurrence o = s.GetNextOccurrence();

			Assert.IsNotNull(o);
			Assert.AreEqual<TimeSpan>(TimeSpan.Zero, o.Duration);
			Assert.AreEqual<DateTime>(dt3, o.Start);
		}

		#endregion
		


		#region Test: public void GetPreviousScheduleOccurrence01()

		[global::Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()]
		[global::Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute(" ")]
		public void GetPreviousScheduleOccurrence01()
		{
			DateTime dt = DateTime.Now.AddMilliseconds(-1);
			WeeklySchedule schedule = new WeeklySchedule();
			schedule.AddAllDays(new TimeOfDay(dt));

			Occurrence o = schedule.GetPreviousOccurrence();
			Assert.IsNotNull(o);
			Assert.AreEqual<DateTime>(dt, o.Start);
		}

		#endregion

		#region Test: public void GetPreviousScheduleOccurrence02()

		[global::Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()]
		[global::Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute(" ")]
		public void GetPreviousScheduleOccurrence02()
		{
			DateTime dt1 = DateTime.Now.AddHours(1);
			DateTime dt2 = dt1.AddDays(-1);
			DateTime dt3 = dt2.AddDays(-1);

			CustomSchedule s = new CustomSchedule();
			s.AddDateTime(dt1);
			s.AddDateTime(dt2);
			s.AddDateTime(dt3);

			Occurrence o = s.GetPreviousOccurrence();

			Assert.IsNotNull(o);
			Assert.AreEqual<TimeSpan>(TimeSpan.Zero, o.Duration);
			Assert.AreEqual<DateTime>(dt2, o.Start);
		}

		#endregion

		#region Test: public void GetPreviousOccurrence03()

		[global::Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()]
		[global::Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute(" ")]
		public void GetPreviousOccurrence03()
		{
			CustomSchedule s = new CustomSchedule();
			s.AddDateTime(DateTime.Now.AddDays(1));

			Occurrence o = s.GetPreviousOccurrence();
			Assert.IsNull(o);
		}

		#endregion



		#region Test: public void ParseTimeOfDay01()

		[global::Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()]
		[global::Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute(" ")]
		public void ParseTimeOfDay01()
		{
			TimeOfDay t = TimeOfDay.Parse("10:00Z");
			Assert.AreEqual<int>(10, t.Hour);
			Assert.AreEqual<int>(0, t.Minute);
			Assert.AreEqual<TimeKind>(TimeKind.Utc, t.Kind);
		}

		#endregion

		#region Test: public void ParseTimeOfDay02()

		[global::Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()]
		[global::Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute(" ")]
		public void ParseTimeOfDay02()
		{
			TimeOfDay t;
			bool b = TimeOfDay.TryParse("14:34:59.521", out t);
			Assert.IsTrue(b);
			Assert.AreEqual<int>(14, t.Hour);
			Assert.AreEqual<int>(34, t.Minute);
			Assert.AreEqual<int>(59, t.Second);
			Assert.AreEqual<int>(521, t.Millisecond);
		}

		#endregion
		


		#region Test: public void SerializeOccurrence01()

		[global::Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()]
		[global::Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute(" ")]
		public void SerializeOccurrence01()
		{
			Occurrence o = new Occurrence(DateTime.Now, TimeSpan.FromHours(1));
			using (MemoryStream strm = new MemoryStream())
			{
				BinaryFormatter bf = new BinaryFormatter();
				bf.Serialize(strm, o);

				Assert.AreNotEqual<long>(0, strm.Length);
			}
		}

		#endregion
		


		#region Test: public void SerializeSchedule01()

		[global::Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()]
		[global::Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute(" ")]
		public void SerializeSchedule01()
		{
			Schedule sched = Schedule.OfficeHours;

			BinaryFormatter formatter = new BinaryFormatter();
			formatter.Serialize(new MemoryStream(), sched);
		}

		#endregion

		#region Test: public void SerializeSchedule02()

		[global::Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()]
		[global::Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute(" ")]
		public void SerializeSchedule02()
		{
			CustomSchedule s = new CustomSchedule();
			s.AddDateTime(DateTime.Now);
			s.AddDateTime(DateTime.Now.AddDays(1));
			s.AddDateTime(DateTime.Now.AddDays(-1));

			byte[] buffer = s.ToByteArray();
			Assert.IsNotNull(buffer);
			Assert.AreNotEqual<int>(0, buffer.Length);
		}

		#endregion
		


		#region Test: public void SortTimeOfDay01()

		[global::Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()]
		[global::Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute(" ")]
		public void SortTimeOfDay01()
		{
			List<TimeOfDay> list = new List<TimeOfDay>();
			list.Add(new TimeOfDay(8));
			list.Add(new TimeOfDay(7));

			list.Sort();

			Assert.AreEqual<int>(7, list[0].Hour);
			Assert.AreEqual<int>(8, list[1].Hour);

		}

		#endregion
		
	}
}
